<?php include_once $_SERVER["DOCUMENT_ROOT"] . '/JuventudeSlz/modelo/dao/GenericDAO.php'; ?>
<?php include_once $_SERVER["DOCUMENT_ROOT"] . '/JuventudeSlz/modelo/bean/Nivel.php'; ?>
<?php include_once $_SERVER["DOCUMENT_ROOT"] . '/JuventudeSlz/utils/System.php'; ?>
<?php

/**
 * Description of NivelDAO
 *
 * @author JoasRamos
 */
class NivelDAO extends GenericDAO {

    public function __construct() {
        parent::__construct();
    }

    /* Pode ser colocado no GenericDAO */

    public function findById($id) {
        $sql = "SELECT * FROM nivel WHERE id=" . $id;
        $bean = new Nivel();

        $result = mysql_query($sql);

        if (mysql_num_rows($result) > 0) {
            while ($row = mysql_fetch_assoc($result)) {
                $bean->setId($row['id']);
                $bean->setNivel($row['nivel']);
                $bean->setDescricao($row['descricao']);
            }
        }
        System::desconectar();
        return $bean;
    }

}

?>
